<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 点击按钮添加一行 tr  -->
</head>
<body>
  <table id="table" border="1">
    <tr>
      <td>Row1 cell1</td>
      <td>Row1 cell2</td>
    </tr>
    <tr>
      <td>Row2 cell1</td>
      <td>Row2 cell2</td>
    </tr>
  </table>
  <button onclick="btn()">添加</button>
  <script>
    function btn(){
      var table = document.getElementById('table');
      var sel = table.insertRow(0);
      var str1 = sel.insertCell(0);
      var str2 = sel.insertCell(1);
      str1.innerHTML = "Row3 cell1";
      str2.innerHTML = "Row3 cell1";
    }
  </script>
</body>
</html>